<%@ page import="dao.CourseDao" %>
<%@ page import="vo.Course" %>
<%@ page import="java.util.ArrayList" %>

<%@ page contentType="application/msexcel" language="java" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <title>main</title>
</head>
<body>
<%
    out.clearBuffer();
    response.setHeader("Content-Disposition", "attachment;filename=excel.xls");
%>
<table align="center" border="1">
    <tr>
        <th height="35">课程序号</th>
        <th>课程名</th>
        <th>授课老师</th>
        <th>开设学院</th>
        <th>选课学号</th>
    </tr>
    <%
        try {
            CourseDao courseDao = new CourseDao();
            ArrayList<Course> cs = courseDao.getOnePage(1, 10000);
            for (Course c : cs) {
    %>
    <tr>
            <td align="center"><%=c.getId()%></td>
            <td align="center"><%=c.getName()%></td>
            <td align="center"><%=c.getTeacher()%></td>
            <td align="center"><%=c.getCollege()%></td>
            <td align="center"><%=c.getStu_id()%></td>
    </tr>
    <%
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    %>
</table>
</body>
</html>

